.class Lcom/xingbook/park/activity/x;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field final synthetic a:Lcom/xingbook/park/activity/HeadImageAct;

.field private final synthetic b:Landroid/app/ProgressDialog;


# direct methods
.method constructor <init>(Lcom/xingbook/park/activity/HeadImageAct;Landroid/app/ProgressDialog;)V
    .locals 0

    iput-object p1, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    iput-object p2, p0, Lcom/xingbook/park/activity/x;->b:Landroid/app/ProgressDialog;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 8

    const/4 v7, 0x4

    const/4 v6, 0x1

    const/4 v1, 0x0

    iget-object v0, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v0}, Lcom/xingbook/park/activity/HeadImageAct;->a(Lcom/xingbook/park/activity/HeadImageAct;)Lcom/xingbook/park/activity/y;

    move-result-object v0

    iget-object v2, p0, Lcom/xingbook/park/activity/x;->b:Landroid/app/ProgressDialog;

    invoke-virtual {v0, v6, v2}, Lcom/xingbook/park/activity/y;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    new-instance v0, Ljava/lang/StringBuilder;

    sget-object v2, Lcom/xingbook/c/c;->s:Ljava/lang/String;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-direct {v0, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v2, "crop.jpg"

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/graphics/BitmapFactory;->decodeFile(Ljava/lang/String;)Landroid/graphics/Bitmap;

    move-result-object v0

    const/16 v2, 0x1e0

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v3

    if-eq v3, v2, :cond_0

    new-instance v5, Landroid/graphics/Matrix;

    invoke-direct {v5}, Landroid/graphics/Matrix;-><init>()V

    int-to-float v2, v2

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v3

    int-to-float v3, v3

    div-float/2addr v2, v3

    invoke-virtual {v5, v2, v2}, Landroid/graphics/Matrix;->postScale(FF)Z

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v3

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v4

    move v2, v1

    invoke-static/range {v0 .. v6}, Landroid/graphics/Bitmap;->createBitmap(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;

    move-result-object v2

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->recycle()V

    :try_start_0
    new-instance v0, Ljava/io/FileOutputStream;

    new-instance v3, Ljava/io/File;

    new-instance v4, Ljava/lang/StringBuilder;

    sget-object v5, Lcom/xingbook/c/c;->s:Ljava/lang/String;

    invoke-static {v5}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v5, "crop.jpg"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-direct {v0, v3}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V

    sget-object v3, Landroid/graphics/Bitmap$CompressFormat;->JPEG:Landroid/graphics/Bitmap$CompressFormat;

    const/16 v4, 0x50

    invoke-virtual {v2, v3, v4, v0}, Landroid/graphics/Bitmap;->compress(Landroid/graphics/Bitmap$CompressFormat;ILjava/io/OutputStream;)Z

    invoke-virtual {v2}, Landroid/graphics/Bitmap;->recycle()V

    invoke-virtual {v0}, Ljava/io/FileOutputStream;->flush()V

    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    :cond_0
    :goto_0
    iget-object v0, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v0}, Lcom/xingbook/park/activity/HeadImageAct;->a(Lcom/xingbook/park/activity/HeadImageAct;)Lcom/xingbook/park/activity/y;

    move-result-object v0

    const/4 v2, 0x2

    iget-object v3, p0, Lcom/xingbook/park/activity/x;->b:Landroid/app/ProgressDialog;

    invoke-virtual {v0, v2, v3}, Lcom/xingbook/park/activity/y;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    :try_start_1
    invoke-static {}, Lcom/xingbook/park/f/s;->a()Lcom/xingbook/park/f/s;

    move-result-object v0

    sget-object v2, Lcom/xingbook/c/n;->e:Lcom/xingbook/b/a;

    invoke-virtual {v2}, Lcom/xingbook/b/a;->d()J

    move-result-wide v2

    new-instance v4, Ljava/lang/StringBuilder;

    sget-object v5, Lcom/xingbook/c/c;->s:Ljava/lang/String;

    invoke-static {v5}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v5

    invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v5, "crop.jpg"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    iget-object v5, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v5}, Lcom/xingbook/park/activity/HeadImageAct;->b(Lcom/xingbook/park/activity/HeadImageAct;)Z

    move-result v5

    if-eqz v5, :cond_2

    :goto_1
    invoke-virtual {v0, v2, v3, v4, v6}, Lcom/xingbook/park/f/s;->a(JLjava/lang/String;I)Ljava/lang/String;

    move-result-object v0

    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    const-string v0, "result"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_7

    const-string v0, "result"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v0

    if-nez v0, :cond_5

    const-string v0, "data"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v0

    if-eqz v0, :cond_5

    const-string v0, "data"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v1}, Lcom/xingbook/park/activity/HeadImageAct;->b(Lcom/xingbook/park/activity/HeadImageAct;)Z

    move-result v1

    if-eqz v1, :cond_3

    invoke-static {}, Lcom/xingbook/c/n;->l()Lcom/xingbook/c/j;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/xingbook/c/j;->d(Ljava/lang/String;)V

    :goto_2
    new-instance v1, Ljava/io/File;

    new-instance v0, Ljava/lang/StringBuilder;

    sget-object v2, Lcom/xingbook/c/c;->s:Ljava/lang/String;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-direct {v0, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v2, "crop.jpg"

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {v1, v0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    new-instance v2, Ljava/io/File;

    new-instance v3, Ljava/lang/StringBuilder;

    sget-object v0, Lcom/xingbook/c/c;->s:Ljava/lang/String;

    invoke-direct {v3, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v0, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v0}, Lcom/xingbook/park/activity/HeadImageAct;->b(Lcom/xingbook/park/activity/HeadImageAct;)Z

    move-result v0

    if-eqz v0, :cond_4

    const-string v0, "c.jpg"

    :goto_3
    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {v2, v0}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, v2}, Ljava/io/File;->renameTo(Ljava/io/File;)Z

    new-instance v0, Ljava/io/File;

    new-instance v1, Ljava/lang/StringBuilder;

    sget-object v2, Lcom/xingbook/c/c;->s:Ljava/lang/String;

    invoke-static {v2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v2

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v2, "m.jpg"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v1

    if-eqz v1, :cond_1

    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    :cond_1
    sget-object v0, Lcom/xingbook/c/n;->e:Lcom/xingbook/b/a;

    iget-object v1, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v1}, Lcom/xingbook/park/activity/HeadImageAct;->b(Lcom/xingbook/park/activity/HeadImageAct;)Z

    move-result v1

    iget-object v2, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-virtual {v2}, Lcom/xingbook/park/activity/HeadImageAct;->getResources()Landroid/content/res/Resources;

    move-result-object v2

    invoke-virtual {v0, v1, v2}, Lcom/xingbook/b/a;->a(ZLandroid/content/res/Resources;)V

    iget-object v0, p0, Lcom/xingbook/park/activity/x;->b:Landroid/app/ProgressDialog;

    invoke-virtual {v0}, Landroid/app/ProgressDialog;->dismiss()V

    iget-object v0, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v0}, Lcom/xingbook/park/activity/HeadImageAct;->a(Lcom/xingbook/park/activity/HeadImageAct;)Lcom/xingbook/park/activity/y;

    move-result-object v0

    const/4 v1, 0x6

    invoke-virtual {v0, v1}, Lcom/xingbook/park/activity/y;->obtainMessage(I)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_1

    :goto_4
    return-void

    :catch_0
    move-exception v0

    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto/16 :goto_0

    :cond_2
    move v6, v1

    goto/16 :goto_1

    :cond_3
    :try_start_2
    invoke-static {}, Lcom/xingbook/c/n;->l()Lcom/xingbook/c/j;

    move-result-object v1

    invoke-virtual {v1, v0}, Lcom/xingbook/c/j;->e(Ljava/lang/String;)V
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_1

    goto/16 :goto_2

    :catch_1
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    iget-object v0, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v0}, Lcom/xingbook/park/activity/HeadImageAct;->a(Lcom/xingbook/park/activity/HeadImageAct;)Lcom/xingbook/park/activity/y;

    move-result-object v0

    invoke-virtual {v0, v7}, Lcom/xingbook/park/activity/y;->obtainMessage(I)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    iget-object v0, p0, Lcom/xingbook/park/activity/x;->b:Landroid/app/ProgressDialog;

    invoke-virtual {v0}, Landroid/app/ProgressDialog;->dismiss()V

    goto :goto_4

    :cond_4
    :try_start_3
    const-string v0, "p.jpg"

    goto/16 :goto_3

    :cond_5
    const/4 v0, 0x0

    const-string v2, "message"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->has(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_6

    const-string v0, "message"

    invoke-virtual {v1, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    :cond_6
    iget-object v1, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v1}, Lcom/xingbook/park/activity/HeadImageAct;->a(Lcom/xingbook/park/activity/HeadImageAct;)Lcom/xingbook/park/activity/y;

    move-result-object v1

    const/4 v2, 0x5

    invoke-virtual {v1, v2, v0}, Lcom/xingbook/park/activity/y;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    iget-object v0, p0, Lcom/xingbook/park/activity/x;->b:Landroid/app/ProgressDialog;

    invoke-virtual {v0}, Landroid/app/ProgressDialog;->dismiss()V

    goto :goto_4

    :cond_7
    iget-object v0, p0, Lcom/xingbook/park/activity/x;->a:Lcom/xingbook/park/activity/HeadImageAct;

    invoke-static {v0}, Lcom/xingbook/park/activity/HeadImageAct;->a(Lcom/xingbook/park/activity/HeadImageAct;)Lcom/xingbook/park/activity/y;

    move-result-object v0

    const/4 v1, 0x4

    invoke-virtual {v0, v1}, Lcom/xingbook/park/activity/y;->obtainMessage(I)Landroid/os/Message;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Message;->sendToTarget()V

    iget-object v0, p0, Lcom/xingbook/park/activity/x;->b:Landroid/app/ProgressDialog;

    invoke-virtual {v0}, Landroid/app/ProgressDialog;->dismiss()V
    :try_end_3
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_3} :catch_1

    goto :goto_4
.end method
